<template>
	<view>
		<uni-card title="职位详情">
			<view>职位名称：{{reactive.professionName}}</view>
			<view>岗位职责：{{reactive.obligation}}</view>
			<view>公司地点：{{reactive.address}}</view>
			<view>薪资待遇：{{reactive.salary}}</view>
			<view>联系人：{{reactive.contacts}}</view>
			<view>职位描述：{{reactive.obligation}}</view>
			<view>职位需求：{{reactive.need}}</view>
		</uni-card>
		<uni-card title="公司信息">
			<view>公司名称：{{reactive2.companyName}}</view>
			<view>公司简介：{{reactive2.introductory}}</view>
		</uni-card>

		<uni-group style="position: fixed;right: 0%;left: 0%;bottom: 0%;">
			<button type="primary" @click="tijiao">提交简历</button>
		</uni-group>
	</view>
</template>

<script>
	import api from 'commer/apiURL.js'
	export default {
		data() {
			return {
				base: api.baseurl,
				conpy: '',
				id: '',
				reactive: '',
				reactive2: '',
				indo: '',
				userJianD:''

			}
		},
		onLoad(options) {
			this.getcongt(options.id)
			this.id = options.id
			this.getinfo()
		},
		methods: {
			getinfo() {
				this.$get(this.base + '/prod-api/api/common/user/getInfo').then((res) => {
					this.indo = res.user
					this.getgern(res.user.userId)
				})
			},
			getgern(id) {
				this.$get(this.base + '/prod-api/api/job/resume/queryResumeByUserId/' + id).then((res) => {
						this.userJianD = res.data
				})
			},
			getcongt(id) {
				this.$get(this.base + '/prod-api/api/job/post/' + id).then((res) => {
					this.reactive = res.data
					this.conpy = res.data.companyId
					this.$get(this.base + '/prod-api/api/job/company/' + res.data.companyId).then((res) => {
						this.reactive2 = res.data
					})
				})
			},
			tijiao() {
				if(this.userJianD == null){
					uni.showToast({
						title:'请填写个人简历',
						icon:'none'
					})
					setTimeout(()=>{
						uni.navigateTo({
							url:'qiu?id='+this.indo.userId
						})
					},500)
					return
				}
				this.$post(this.base + '/prod-api/api/job/deliver', {
					"companyId": this.conpy,
					"companyName": this.reactive2.companyName,
					"id": this.id,
					"money": this.reactive.salary,
					"postId": this.reactive.id,
					"postName": this.reactive.name,
					"satrTime": new Date(),
					"userId": this.indo.userId,
					"userName": this.indo.userName
				}).then((res) => {
					if (res.code == 200) {
						uni.showToast({
							title: "投递成功",
						})
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				})
			}
		}
	}
</script>

<style>

</style>
